import { createRouter, createWebHistory } from "vue-router";
/* 导入过滤后的路由 */
import { routerFilter } from './filterRouter'
/* 不需要权限控制的页面 */
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      //重定向登录页面
      path: "/",
      redirect: "./login",
    },
    /* 当用户没有权限是进入home会被重新登录界面 */
    {
      path: "/home",
      name: "home",
      redirect: "./login",
    },
    {
      path: "/login",
      name: "login",
      component: () => import("../views/Login/index.vue"),
    },
    {
      path: '/signin',
      name: 'signin',
      component: () => import('../views/Login/Signin.vue'),
    },

    {
      path: "/:cathchAll(.*)",
      name: "404",
      component: () => import("../views/404/index.vue"),
    },
  ],
});
/* 加入过滤后的路由 */
if (routerFilter.length != 0) {
  router.addRoute(routerFilter[0])
}
export default router;
